//
//  tiXianViewController.m
//  DJS
//
//  Created by mac on 2017/12/27.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "tiXianViewController.h"
#import "tiXianView.h"
#import "TiXianJiLuViewController.h"
@interface tiXianViewController ()
@property(nonatomic,strong)tiXianView *aView;
@end

@implementation tiXianViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title=@"提现";
    self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc] initWithTitle:@"明细" style:UIBarButtonItemStylePlain target:self action:@selector(PushToMingXi:)];
    _aView=[tiXianView new];
    [self.view addSubview:_aView];
    [_aView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.bottom.mas_equalTo(0);
    }];

    [self loadData2];
    _aView.viewController=self;
}
-(IBAction)PushToMingXi:(id)sender{
    TiXianJiLuViewController *tixian=[[TiXianJiLuViewController alloc]init];
    [ZQTools pushNextViewController:self andRootController:tixian];
}
-(void)loadData{
    NSDictionary *userDic = [NSKeyedUnarchiver unarchiveObjectWithFile:_userModelFile];
    NSString *token=[userDic objectForKey:@"token"];
    NSNumber *waiter_id1=[userDic objectForKey:@"waiter_id"];
    NSString *user_id=[NSString stringWithFormat:@"%@",waiter_id1];
    NSDictionary *dic=[NSDictionary dictionaryWithObjectsAndKeys:user_id,@"waiter_id",token,@"token",@"1",@"user_role", nil];
    [ZQTools AFNPostDataUrl:@"waiter/account/min_cash" Dict:dic andTableView:nil andViewController:self andSuccessBlock:^(id responseObject) {
        _aView.zuiXiao=responseObject;
         [_aView creatView];
    } anderrorBlock:nil];
    
}
-(void)loadData2{
    NSString *edition_num=[ZQTools getAPPBanben];
    NSDictionary *userDic = [NSKeyedUnarchiver unarchiveObjectWithFile:_userModelFile];
    NSString *token=[userDic objectForKey:@"token"];
    NSNumber *waiter_id1=[userDic objectForKey:@"waiter_id"];
    NSString *user_id=[NSString stringWithFormat:@"%@",waiter_id1];
    NSDictionary *dic=[NSDictionary dictionaryWithObjectsAndKeys:user_id,@"waiter_id",token,@"token",@"1",@"user_role",edition_num,@"edition_num", nil];
    [ZQTools AFNPostDataUrl:@"waiter/account/is_alipay" Dict:dic andTableView:nil andViewController:self andSuccessBlock:^(id responseObject) {
        _aView.ZHBIsOrNo=![responseObject boolValue];
        [self loadData];
    } anderrorBlock:nil];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
